import com.aliyun.odps.udf.ExecutionContext;
import com.aliyun.odps.udf.UDFException;
import com.aliyun.odps.udf.UDTF;
import com.aliyun.odps.udf.annotation.Resolve;

/*
    a,1,2,3,4,5,6,7,8,9,10,11,12
    b,11,22,33,44,55,66,77,88,99,100,110,120
    c,101,102,103,104,105,106,107,108,109,110,120
 */
// TODO define input and output types, e.g. "string,string->string,bigint".
@Resolve({"string,*->string,string,string"})
public class UDTFDemo3 extends UDTF {

    @Override
    public void setup(ExecutionContext ctx) throws UDFException {
        // 在这里连接一些外部资源【可以连接阿里云其他产品】
    }

    @Override
    public void process(Object[] args) throws UDFException {
        // TODO 核心逻辑，编写如何将传入的数据转变多条数据出来
        String id = args[0].toString();
        long t = 0;
        for(int i=1;i<args.length;i++){
            t+=2;
            forward(id,t+"时", args[i]);
        }

    }

    @Override
    public void close() throws UDFException {
        //关闭阿里云其他产品的连接
    }

}